package com.example.tests;

import java.util.Set;

import org.testng.annotations.Test;

public class ContactCreationTests extends TestBase {
	
	@Test(dataProvider = "contactsFromFile", dataProviderClass = ContactDataGenerator.class)
	public void testValidContactCanBeCreated(ContactObject validContact) throws Exception {
		Set<ContactObject> oldList = app.getContactHelper().getContacts();
		// action
		app.getContactHelper().createContact(validContact);
		Set<ContactObject> newList = app.getContactHelper().getContacts();
		verifyContactAdded(oldList, validContact, newList);
	}

	@Test
	public void testContactWithEmptyDataCanBeCreated() throws Exception {
		ContactObject emptyContact = new ContactObject()
			.setFirstName("")
			.setLastName("")
			.setAddress("")
			.setHome("")
			.setMobile("")
			.setWork("")
			.setEmail("")
			.setEmail2("")
			.setBday("-")
			.setBmonth("-")
			.setByear("")
			.setNew_group("[none]")
			.setAddress2("")
			.setPhone2("");
		Set<ContactObject> oldList = app.getContactHelper().getContacts();
		app.getContactHelper().createContact(emptyContact);
		Set<ContactObject> newList = app.getContactHelper().getContacts();
		verifyContactAdded(oldList, emptyContact, newList);
	}

}
